package com.fr.chart.axis;

import com.fr.base.core.json.JSONException;
import com.fr.base.core.json.JSONObject;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.chart.DataSeriesCondition;
import com.fr.chart.base.equals.Equals;
import com.fr.chart.core.ChartUtils;
import com.fr.util.Utils;
import java.awt.Color;

public class SeriesAttrLine
  implements DataSeriesCondition
{
  private static final long serialVersionUID = 8393504378490600313L;
  public static final String XML_TAG = "SeriesAttrLine";
  private int seriesLineStyle = 1;
  private Color seriesLineColor = null;

  public SeriesAttrLine()
  {
  }

  public SeriesAttrLine(Color paramColor, int paramInt)
  {
    this.seriesLineColor = paramColor;
    this.seriesLineStyle = paramInt;
  }

  public void setSeriesLineStyle(int paramInt)
  {
    this.seriesLineStyle = paramInt;
  }

  public int getSeriesLineStyle()
  {
    return this.seriesLineStyle;
  }

  public void setSeriesLineColor(Color paramColor)
  {
    this.seriesLineColor = paramColor;
  }

  public Color getSeriesLineColor()
  {
    return this.seriesLineColor;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str1 = paramXMLableReader.getTagName();
      if (str1.equals("Attr"))
      {
        String str2;
        if ((str2 = paramXMLableReader.getAttr("lineStyle")) != null)
          setSeriesLineStyle(Utils.string2Number(str2).intValue());
        if ((str2 = paramXMLableReader.getAttr("lineColor")) != null)
          setSeriesLineColor(new Color(Utils.string2Number(str2).intValue(), true));
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("SeriesAttrLine");
    paramXMLPrintWriter.startTAG("Attr").attr("lineStyle", this.seriesLineStyle);
    if (this.seriesLineColor != null)
      paramXMLPrintWriter.attr("lineColor", this.seriesLineColor.getRGB());
    paramXMLPrintWriter.end();
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof SeriesAttrLine))
      return false;
    SeriesAttrLine localSeriesAttrLine = (SeriesAttrLine)paramObject;
    if (localSeriesAttrLine.seriesLineStyle != this.seriesLineStyle)
      return false;
    return (Equals.equals(localSeriesAttrLine.seriesLineColor, this.seriesLineColor));
  }

  public JSONObject toJSONObject()
    throws JSONException
  {
    JSONObject localJSONObject = new JSONObject();
    localJSONObject.put("seriesLineStyle", this.seriesLineStyle);
    localJSONObject.put("seriesLineColor", ChartUtils.color2JS(this.seriesLineColor));
    return localJSONObject;
  }

  public String getConditionType()
  {
    return "SeriesAttrLine";
  }
}